<?php


    //前端页面
    Route::group(["middleware"=>'front.login'],function(){
        Route::get('/', 'Home\\IndexController@index');
        Route::get('/post/{id}', 'Home\\IndexController@post');//与administrator 冲突了
        Route::get('/posts', 'Home\\IndexController@posts');
        Route::get('/invest','Home\\InvestController@index');
        Route::get('/search/{keyword}','Home\\IndexController@search');

        Route::get('/page/{id}','Home\\PageController@index');
    });


    //注册 和 登录
    Route::post('/user/login','Home\\UserController@login');
    Route::post('/user/register','Home\\UserController@register');

    //留言
    Route::post('/message/store','Home\\MessageController@store');

    //后台管理
    Route::group(['middleware'=>'admin.auth'],function(){

        //可视化模块编辑
        Route::get('/edit/{id?}','Home\\IndexController@edit');//测试编辑的页面
        Route::get('/content','Home\\IndexController@content');//被编辑的页面
        Route::get('/model/parse/{modelId}/{modelName}','Home\\ModelController@parse');
        Route::get('/model/delete/{modelId}','Home\\ModelController@delete');
        Route::get('/model/edit/{modelId}','Home\\ModelController@edit');
        Route::get('/model/choice/{modelId}/{modelName}','Home\\ModelController@choice');
        Route::post('model/save','Home\\ModelController@save');


        Route::get('/administrator/page', 'Admin\\PageController@index');
        Route::post('/administrator/page', 'Admin\\PageController@store');
        Route::get('/administrator/page/create', 'Admin\\PageController@create');
        Route::get('/administrator/page/{id}/edit', 'Admin\\PageController@edit');
        Route::post('/administrator/page/{id}', 'Admin\\PageController@update');
        Route::get('/administrator/page/{id}/delete','Admin\\PageController@delete');

        //模块的管理
        Route::post('/imagetext/saveparam','Model\\ImageTextController@save');


        Route::get('/administrator', 'Admin\\AdministratorController@index');
        //文章管理
        Route::get('/administrator/{type}/post', 'Admin\\PostController@index');//type 放在后面与create冲突了
        Route::post('/administrator/post', 'Admin\\PostController@store');
        Route::get('/administrator/post/create', 'Admin\\PostController@create');
        Route::get('/administrator/post/{id}/edit', 'Admin\\PostController@edit');
        Route::get('/administrator/post/{id}/publish', 'Admin\\PostController@publish');//发布
        Route::get('/administrator/post/{id}/trash', 'Admin\\PostController@trash');//回收
        Route::post('/administrator/post/{id}', 'Admin\\PostController@update');
        Route::get('/administrator/post/{id}/delete','Admin\\PostController@delete');

        //文章分类管理
        Route::get('/administrator/postCid', 'Admin\\PostCidController@index');
        Route::post('/administrator/postCid', 'Admin\\PostCidController@store');
        Route::get('/administrator/postCid/create', 'Admin\\PostCidController@create');
        Route::get('/administrator/postCid/{id}/edit', 'Admin\\PostCidController@edit');
        Route::post('/administrator/postCid/{id}', 'Admin\\PostCidController@update');
        Route::get('/administrator/postCid/{id}/delete','Admin\\PostCidController@delete');

        //菜单管理
        Route::get('/administrator/menu', 'Admin\\MenuController@index');
        Route::post('/administrator/menu', 'Admin\\MenuController@store');
        Route::get('/administrator/menu/create', 'Admin\\MenuController@create');
        Route::get('/administrator/menu/{id}/edit', 'Admin\\MenuController@edit');
        Route::post('/administrator/menu/{id}', 'Admin\\MenuController@update');
        Route::get('/administrator/menu/{id}/delete','Admin\\MenuController@delete');

        //配置管理
        Route::get('/administrator/config', 'Admin\\ConfigController@index');
        Route::post('/administrator/config', 'Admin\\ConfigController@store');
        Route::get('/administrator/config/create', 'Admin\\ConfigController@create');
        Route::get('/administrator/config/{id}/edit', 'Admin\\ConfigController@edit');
        Route::post('/administrator/config/{id}', 'Admin\\ConfigController@update');
        Route::get('/administrator/config/{id}/delete','Admin\\ConfigController@delete');

        //轮播管理
        Route::get('/administrator/banner', 'Admin\\BannerController@index');
        Route::post('/administrator/banner', 'Admin\\BannerController@store');
        Route::get('/administrator/banner/create', 'Admin\\BannerController@create');
        Route::get('/administrator/banner/{id}/edit', 'Admin\\BannerController@edit');
        Route::post('/administrator/banner/{id}', 'Admin\\BannerController@update');
        Route::get('/administrator/banner/{id}/delete','Admin\\BannerController@delete');

        //广告管理
        Route::get('/administrator/ad', 'Admin\\AdController@index');
        Route::post('/administrator/ad', 'Admin\\AdController@store');
        Route::get('/administrator/ad/create', 'Admin\\AdController@create');
        Route::get('/administrator/ad/{id}/edit', 'Admin\\AdController@edit');
        Route::post('/administrator/ad/{id}', 'Admin\\AdController@update');
        Route::get('/administrator/ad/{id}/delete','Admin\\AdController@delete');

        //推荐位置管理
        Route::get('/administrator/recommend', 'Admin\\RecommendController@index');
        Route::post('/administrator/recommend', 'Admin\\RecommendController@store');
        Route::get('/administrator/recommend/create', 'Admin\\RecommendController@create');
        Route::get('/administrator/recommend/{id}/edit', 'Admin\\RecommendController@edit');
        Route::post('/administrator/recommend/{id}', 'Admin\\RecommendController@update');
        Route::get('/administrator/recommend/{id}/delete','Admin\\RecommendController@delete');
        Route::get('/administrator/recommend/{id}/append','Admin\\RecommendController@append');//添加推荐位
        Route::get('/administrator/recommend/{recid}/appendAction/{postid}','Admin\\RecommendController@appendAction');
        Route::get('/administrator/recommend/{id}/showAppend','Admin\\RecommendController@showAppend');//查看
        Route::get('/administrator/recommend/{recid}/cancelAppend/{postid}','Admin\\RecommendController@cancelAppend');

        //友情连接  品牌推荐  自媒体平台
        Route::get('/administrator/friend/type/{type}', 'Admin\\FriendController@index');
        Route::post('/administrator/friend', 'Admin\\FriendController@store');
        Route::get('/administrator/friend/create/type/{type}', 'Admin\\FriendController@create');
        Route::get('/administrator/friend/{id}/edit', 'Admin\\FriendController@edit');
        Route::post('/administrator/friend/{id}', 'Admin\\FriendController@update');
        Route::get('/administrator/friend/{id}/delete','Admin\\FriendController@delete');

        //标签管理
        Route::get('/administrator/tag', 'Admin\\TagController@index');
        Route::post('/administrator/tag', 'Admin\\TagController@store');
        Route::get('/administrator/tag/create', 'Admin\\TagController@create');
        Route::get('/administrator/tag/{id}/edit', 'Admin\\TagController@edit');
        Route::post('/administrator/tag/{id}', 'Admin\\TagController@update');
        Route::get('/administrator/tag/{id}/delete','Admin\\TagController@delete');



        //会员管理
        Route::get('/administrator/member', 'Admin\\MemberController@index');
        Route::post('/administrator/member', 'Admin\\MemberController@store');
        Route::get('/administrator/member/create', 'Admin\\MemberController@create');
        Route::get('/administrator/member/{id}/edit', 'Admin\\MemberController@edit');
        Route::post('/administrator/member/{id}', 'Admin\\MemberController@update');
        Route::get('/administrator/member/{id}/delete','Admin\\MemberController@delete');


        //后台管理员
        Route::get('/administrator/manager', 'Admin\\ManagerController@index');
        Route::post('/administrator/manager', 'Admin\\ManagerController@store');
        Route::get('/administrator/manager/create', 'Admin\\ManagerController@create');
        Route::get('/administrator/manager/{id}/edit', 'Admin\\ManagerController@edit');
        Route::post('/administrator/manager/{id}', 'Admin\\ManagerController@update');
        Route::get('/administrator/manager/{id}/delete','Admin\\ManagerController@delete');

        //留言管理
        Route::get('/administrator/message', 'Admin\\MessageController@index');
        Route::post('/administrator/message', 'Admin\\MessageController@store');
        Route::get('/administrator/message/create', 'Admin\\MessageController@create');
        Route::get('/administrator/message/{id}/edit', 'Admin\\MessageController@edit');
        Route::post('/administrator/message/{id}', 'Admin\\MessageController@update');
        Route::get('/administrator/message/{id}/delete','Admin\\MessageController@delete');
        Route::post('/administrator/message/changeStatus/{id}',"Admin\\MessageController@changeStatus");

        //图片上传
        Route::any("/administrator/upload","Admin\\UploadController@upload");
        Route::any("/administrator/wangEditorUpload","Admin\\UploadController@wangEditorUpload");

    });

    Route::any('/administrator/signIn', 'Admin\\AdministratorController@signIn');
    Route::get('/administrator/signOut', 'Admin\\AdministratorController@signOut');




//需要跳转微信的页面
Route::group(['middleware' => 'wechat.oauth'], function () {

});

//微信
Route::any('/callbacks/wechat', 'CallbackController@listenToWechat');
Route::any('/callbacks/payments/yunpay/notify', 'CallbackController@listenToYunpay');
Route::any('/callbacks/payments/yunpay/return', 'CallbackController@listenToYunpayReturn');

Route::get('/test', 'TestController@run');
